import requests

from config import BASE_URL, HEADERS


class BoysApi:

    #查询列表
     @classmethod
     def get_boys_list(cls):
       return requests.get(url=BASE_URL + "/boys/",headers=HEADERS)
    #新增男生
     def add_boys(self,add_data): #data 数据
         self.get_boys_list()
         return requests.post(url=BASE_URL + "/boys/",json=add_data,headers=HEADERS)
    #修改
     # params   表单 (data))  json

     def update_boys(self,update_data):
         return  requests.put(url=BASE_URL + "/boys/",json=update_data,headers=HEADERS)
    #删除
     def delete_boys(self,delete_data):
         return requests.delete(url=BASE_URL + "/boys/",data=delete_data,headers=HEADERS)
    #按主键查询
     def get_boys_by_id(self,id):
         return requests.get(url=BASE_URL + "/boys/"+str(id),headers=HEADERS)

    #男生喜欢列表,请求参数是boyName放在表单中
     def get_boys_like_list(self,boyName):
         return  requests.get(url=BASE_URL + "/boys/boysBeauty",data=boyName,headers=HEADERS)
